require('./weapp-adapter.js');
require('./manifest.js');
require('./egret.wxgame.js');
egret.wxgame.isSubContext = true;

window.isShow = function (v1, v2) {
  v1 = v1.split('.')
  v2 = v2.split('.')
  var len = Math.max(v1.length, v2.length)

  while (v1.length < len) {
    v1.push('0')
  }
  while (v2.length < len) {
    v2.push('0')
  }
  for (var i = 0; i < len; i++) {
    var num1 = parseInt(v1[i])
    var num2 = parseInt(v2[i])

    if (num1 > num2) {
      return true;
    } else if (num1 < num2) {
      return false;
    }
  }
  return true;
}
wx.getSystemInfo({
  success: function (res) {
    if (window.isShow(res.SDKVersion,"1.9.92")){
      runShareCanvas();
    }else{
    }
  }
});
function runShareCanvas() {
  egret.runEgret({
    //以下为自动修改，请勿修改
    //The following is automatically modified, please do not modify
    //----auto option start----
		entryClassName: "Main",
		orientation: "auto",
		frameRate: 60,
		scaleMode: "fixedWidth",
		contentWidth: 750,
		contentHeight: 1334,
		showFPS: false,
		fpsStyles: "x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9",
		showLog: false,
		maxTouches: 2,
		//----auto option end----
    renderMode: 'canvas',
    audioType: 0,
    calculateCanvasScaleFactor: function (context) {
      var backingStore = context.backingStorePixelRatio ||
        context.webkitBackingStorePixelRatio ||
        context.mozBackingStorePixelRatio ||
        context.msBackingStorePixelRatio ||
        context.oBackingStorePixelRatio ||
        context.backingStorePixelRatio || 1;
      return (window.devicePixelRatio || 1) / backingStore;
    }
  });
}
// require("egret.min.js")
